var app = getApp();
var utils=require('../../utils/util.js');
var detailData={
    pageId:0,
    content:[//列表数据，一个对象代表一个列表的内容
        {
            "id":1001,//此id跟列表页的id对应
            "src":"../../images/4.jpg",
            "mode":"aspectFit",
            "title":"溜进北京路步行街，整个都漂起来了",
            "position":"上下九|A cafe",
            "smallImgSrc":"../../images/small-3.jpg",
            "name":"张三",
            "date":"2017-02-06",
            "browse":"1238",
            "descrpit":"如果列表中项目的位置会动态改变或者有新的项目添加到列表中，并且希望列表中的项目保持自己的特征和状态（如 <input/> 中的输入内容，<switch/> 的选中状态），需要使用 wx:key 来指定列表中项目的唯一的标识符",
            "thisCt":[
                {
                    "contentTitle":"北京路",
                    "contentImg":["../../images/1.jpg","../../images/2.jpg","../../images/3.jpg"]
                },
                {
                    "contentTitle":"上下九",
                    "contentImg":["../../images/4.jpg","../../images/5.jpg"]
                },
                {
                    "contentTitle":"商场超市",
                    "contentImg":["../../images/2.jpg"]
                }
            ],
            'label':["北京路","饮品","闺蜜聚会","拍照","甜","沙拉","咖啡","吐司","意粉"],
            'detail':{
                "title":"A cafe-人均58元",
                "src":"",
                "address":"广州市天河区科华街251号天盈创意园B区5001",
                "phone":"13566661111",
                "time":"11:00-22:00",
                "longitude": 113.324500,
                "latitude": 23.099914
            },
            'comments':[
                {
                    "src":"../../images/small-3.jpg",
                    "name":"张三(一)",
                    "time":"3分钟前",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-2.jpg",
                    "name":"李四(一)",
                    "time":"2017-02-01",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-1.jpg",
                    "name":"王五(一)",
                    "time":"2017-01-28",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-4.jpg",
                    "name":"老六(一)",
                    "time":"2017-01-26",
                    "cmmts":"好东西福利好好福利"
                }
            ],
            "writecomments":"写下你的评论"
        },
        {
            "id":2001,
            "src":"../../images/3.jpg",
            "mode":"aspectFit",
            "title":"溜进北京路步行街，整个都漂起来了",
            "position":"商场超市|A cafe",
            "smallImgSrc":"../../images/small-4.jpg",
            "name":"李四",
            "date":"2017-02-06",
            "browse":"38",
            "descrpit":"如果列表中项目的位置会动态改变或者有新的项目添加到列表中，并且希望列表中的项目保持自己的特征和状态（如 <input/> 中的输入内容，<switch/> 的选中状态），需要使用 wx:key 来指定列表中项目的唯一的标识符",
            "thisCt":[
                {
                    "contentTitle":"北京路12128",
                    "contentImg":["../../images/1.jpg","../../images/2.jpg","../../images/3.jpg"]
                },
                {
                    "contentTitle":"上下九12128 需要使用 wx:key 来指定列",
                    "contentImg":["../../images/4.jpg","../../images/5.jpg","../../images/2.jpg","../../images/2.jpg"]
                },
                {
                    "contentTitle":"商场超市12128 项目保持自己的特征和状态项目保持自己的特征和状态项目保持自己的特征和状态项目保持自己的特征和状态项目保持自己的特征和状态项目保持自己的特征和状态",
                    "contentImg":["../../images/2.jpg","../../images/2.jpg"]
                }
            ],
            'label':["北京路","饮品","闺蜜聚会","拍照","甜","沙拉","咖啡","吐司","意粉","饮品"],
            'detail':{
                "title":"A cafe-人均58元",
                "src":"",
                "address":"广州市天河区科华街251号天盈创意园B区5001",
                "phone":"13599992222",
                "time":"11:00-22:00",
                "longitude": 113.324510,
                "latitude": 23.099944
            },
            'comments':[
                {
                    "src":"../../images/small-3.jpg",
                    "name":"张三(二)",
                    "time":"3分钟前",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-2.jpg",
                    "name":"李四(二)",
                    "time":"2017-02-01",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-1.jpg",
                    "name":"王五(二)",
                    "time":"2017-01-28",
                    "cmmts":"好东西福利好好福利"
                }
            ],
            "writecomments":"写下你的评论"
        },
        {
            "id":3001,
            "src":"../../images/5.jpg",
            "mode":"aspectFit",
            "title":"溜进北京路步行街，整个都漂起来了",
            "position":"北京路|A cafe",
            "smallImgSrc":"../../images/small-5.jpg",
            "name":"王五",
            "date":"2017-02-06",
            "browse":"9999",
            "descrpit":"如果列表中项目的位置会动态改变或者有新的项目添加到列表中，并且希望列表中的项目保持自己的特征和状态（如 <input/> 中的输入内容，<switch/> 的选中状态），需要使用 wx:key 来指定列表中项目的唯一的标识符",
            "thisCt":[
                {
                    "contentTitle":"北京路12129 表中项目的位置会动态改变或者有新的项目添加到列表中项目的位置会动态改变或者有新的项目添加到列",
                    "contentImg":["../../images/1.jpg","../../images/3.jpg"]
                },
                {
                    "contentTitle":"上下九12129 来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识",
                    "contentImg":["../../images/4.jpg","../../images/5.jpg","../../images/2.jpg"]
                },
                {
                    "contentTitle":"商场超市12129 需要使用 wx:key 来指定列需要使用 wx:key 来指定列",
                    "contentImg":["../../images/2.jpg"]
                }
            ],
            'label':["北京路","饮品","咖啡","吐司","意粉"],
            'detail':{
                "title":"A cafe-人均58元",
                "src":"",
                "address":"广州市天河区科华街251号天盈创意园B区5001",
                "phone":"13588883333",
                "time":"11:00-22:00",
                "longitude": 113.324520,
                "latitude": 23.099964
            },
            'comments':[
                {
                    "src":"../../images/small-3.jpg",
                    "name":"张三(三)",
                    "time":"3分钟前",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-2.jpg",
                    "name":"李四(三)",
                    "time":"2017-02-01",
                    "cmmts":"新年好福利"
                },
                {
                    "src":"../../images/small-1.jpg",
                    "name":"王五(三)",
                    "time":"2017-01-28",
                    "cmmts":"好东西福利好好福利新年好福利"
                }
            ],
            "writecomments":"写下你的评论"
        },
        {
            "id":4001,
            "src":"../../images/5.jpg",
            "mode":"aspectFit",
            "title":"溜进北京路步行街，整个都漂起来了",
            "position":"北京路|A cafe",
            "smallImgSrc":"../../images/small-5.jpg",
            "name":"王五",
            "date":"2017-02-06",
            "browse":"9999",
            "descrpit":"如果列表中项目的位置会动态改变或者有新的项目添加到列表中，并且希望列表中的项目保持自己的特征和状态（如 <input/> 中的输入内容，<switch/> 的选中状态），需要使用 wx:key 来指定列表中项目的唯一的标识符",
            "thisCt":[
                {
                    "contentTitle":"北京路12129 表中项目的位置会动态改变或者有新的项目添加到列表中项目的位置会动态改变或者有新的项目添加到列",
                    "contentImg":["../../images/1.jpg","../../images/3.jpg"]
                },
                {
                    "contentTitle":"上下九12129 来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识",
                    "contentImg":["../../images/4.jpg","../../images/5.jpg","../../images/2.jpg"]
                },
                {
                    "contentTitle":"商场超市12129 需要使用 wx:key 来指定列需要使用 wx:key 来指定列",
                    "contentImg":["../../images/2.jpg"]
                }
            ],
            'label':["北京路","饮品","咖啡","吐司","意粉"],
            'detail':{
                "title":"A cafe-人均58元",
                "src":"",
                "address":"广州市天河区科华街251号天盈创意园B区5001",
                "phone":"13588883333",
                "time":"11:00-22:00",
                "longitude": 113.324520,
                "latitude": 23.099964
            },
            'comments':[
                {
                    "src":"../../images/small-3.jpg",
                    "name":"张三(三)",
                    "time":"3分钟前",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-2.jpg",
                    "name":"李四(三)",
                    "time":"2017-02-01",
                    "cmmts":"新年好福利"
                },
                {
                    "src":"../../images/small-1.jpg",
                    "name":"王五(三)",
                    "time":"2017-01-28",
                    "cmmts":"好东西福利好好福利新年好福利"
                }
            ],
            "writecomments":"写下你的评论"
        },
        {
            "id":5001,
            "src":"../../images/5.jpg",
            "mode":"aspectFit",
            "title":"溜进北京路步行街，整个都漂起来了",
            "position":"北京路|A cafe",
            "smallImgSrc":"../../images/small-5.jpg",
            "name":"王五",
            "date":"2017-02-06",
            "browse":"9999",
            "descrpit":"如果列表中项目的位置会动态改变或者有新的项目添加到列表中，并且希望列表中的项目保持自己的特征和状态（如 <input/> 中的输入内容，<switch/> 的选中状态），需要使用 wx:key 来指定列表中项目的唯一的标识符",
            "thisCt":[
                {
                    "contentTitle":"北京路12129 表中项目的位置会动态改变或者有新的项目添加到列表中项目的位置会动态改变或者有新的项目添加到列",
                    "contentImg":["../../images/1.jpg","../../images/3.jpg"]
                },
                {
                    "contentTitle":"上下九12129 来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识",
                    "contentImg":["../../images/4.jpg","../../images/5.jpg","../../images/2.jpg"]
                },
                {
                    "contentTitle":"商场超市12129 需要使用 wx:key 来指定列需要使用 wx:key 来指定列",
                    "contentImg":["../../images/2.jpg"]
                }
            ],
            'label':["北京路","饮品","咖啡","吐司","意粉"],
            'detail':{
                "title":"A cafe-人均58元",
                "src":"",
                "address":"广州市天河区科华街251号天盈创意园B区5001",
                "phone":"13588883333",
                "time":"11:00-22:00",
                "longitude": 113.324520,
                "latitude": 23.099964
            },
            'comments':[
                {
                    "src":"../../images/small-3.jpg",
                    "name":"张三(三)",
                    "time":"3分钟前",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-2.jpg",
                    "name":"李四(三)",
                    "time":"2017-02-01",
                    "cmmts":"新年好福利"
                },
                {
                    "src":"../../images/small-1.jpg",
                    "name":"王五(三)",
                    "time":"2017-01-28",
                    "cmmts":"好东西福利好好福利新年好福利"
                }
            ],
            "writecomments":"写下你的评论"
        },
        {
            "id":6001,
            "src":"../../images/5.jpg",
            "mode":"aspectFit",
            "title":"溜进北京路步行街，整个都漂起来了",
            "position":"北京路|A cafe",
            "smallImgSrc":"../../images/small-5.jpg",
            "name":"王五",
            "date":"2017-02-06",
            "browse":"9999",
            "descrpit":"如果列表中项目的位置会动态改变或者有新的项目添加到列表中，并且希望列表中的项目保持自己的特征和状态（如 <input/> 中的输入内容，<switch/> 的选中状态），需要使用 wx:key 来指定列表中项目的唯一的标识符",
            "thisCt":[
                {
                    "contentTitle":"北京路12129 表中项目的位置会动态改变或者有新的项目添加到列表中项目的位置会动态改变或者有新的项目添加到列",
                    "contentImg":["../../images/1.jpg","../../images/3.jpg"]
                },
                {
                    "contentTitle":"上下九12129 来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识来指定列表中项目的唯一的标识",
                    "contentImg":["../../images/4.jpg","../../images/5.jpg","../../images/2.jpg"]
                },
                {
                    "contentTitle":"商场超市12129 需要使用 wx:key 来指定列需要使用 wx:key 来指定列",
                    "contentImg":["../../images/2.jpg"]
                }
            ],
            'label':["北京路","饮品","咖啡","吐司","意粉"],
            'detail':{
                "title":"A cafe-人均58元",
                "src":"",
                "address":"广州市天河区科华街251号天盈创意园B区5001",
                "phone":"13588883333",
                "time":"11:00-22:00",
                "longitude": 113.324520,
                "latitude": 23.099964
            },
            'comments':[
                {
                    "src":"../../images/small-3.jpg",
                    "name":"张三(三)",
                    "time":"3分钟前",
                    "cmmts":"好东西福利好好福利"
                },
                {
                    "src":"../../images/small-2.jpg",
                    "name":"李四(三)",
                    "time":"2017-02-01",
                    "cmmts":"新年好福利"
                },
                {
                    "src":"../../images/small-1.jpg",
                    "name":"王五(三)",
                    "time":"2017-01-28",
                    "cmmts":"好东西福利好好福利新年好福利"
                }
            ],
            "writecomments":"写下你的评论"
        }
    ]
    
};
Page({
    data:detailData,
    onLoad:function(e){
        console.log(e);
        this.setData({
            pageId:e.id
        });
    },
  onShow: function(e) {
    var commentIndex = utils.findIndex(this.data.content,this.data.pageId);
        console.log("当前显示数据的索引为："+commentIndex);
  },
calling:function(e){
    var contentIndex=e.currentTarget.dataset.index;
    wx.makePhoneCall({
        phoneNumber:this.data.content[contentIndex].detail.phone,
        success:function(){
            console.log("拨打电话成功！");
        },
        fail:function(){
            console.log("拨打电话失败！");
        }
    })
  }
})